//
//  L2Range.m
//  Lesson2
//
//  Created by Alexander Trifonov on 20.04.12.
//  Copyright (c) 2012 fgengine@gmail.com. All rights reserved.
//

#import "L2Range.h"

@implementation L2Range

- (void) execute
{
    NSLog(@"-L2Range--------------------------------");
    
    NSString *s = @"Student name: Bill";
    NSRange r = NSMakeRange(14, 4);
    NSLog(@"%@", [s substringWithRange:r]);
    
    NSLog(@"----------------------------------------");
    
    NSRange r1;
    r1.location = 14;
    r1.length = 4;
    NSLog(@"r1.location = %i  r1.length = %i", r1.location, r1.length);
    
    NSLog(@"----------------------------------------");
    
    NSString *url = @"http://examples.com";
    NSRange range = NSMakeRange(7, [url length]-7);
    NSString *subString = [url substringWithRange:range];
    NSLog(@"subString = %@", subString);
    
    NSLog(@"----------------------------------------");
    
    BOOL equal = NSEqualRanges(r, r1);
    NSLog(@"r is equal r1? %i", equal);
    
    NSLog(@"----------------------------------------");
}

@end
